const Koa = require("koa");
const router = require("koa-router")();
const app = new Koa();
// const router = new Router();

router.get("/",async (ctx)=>{
    ctx.body = `
    <h1>home page</h1>
    <a href="/video">video</a>
    <a href="/news">news</a>
    <img src="20430.jpg">
    `;
})
router.get("/video",async (ctx)=>{
    ctx.body = `
    <h1>video page</h1>
    <a href="/">home</a>
    <a href="/news">news</a>
    `;
})
router.get("/news",async (ctx)=>{
    ctx.body = `
    <h1>news page</h1>
    <a href="/">首页</a>
    <a href="/video">video</a>
    `;
})

app.use(router.routes()); // 将多个路由进行启动

app.listen(3000,()=>{
    console.log("服务器运行在3000端口！")
})